// eslint-disable-next-line @typescript-eslint/class-name-casing
interface jQuery {
  [index: number]: any;
}
// eslint-disable-next-line @typescript-eslint/class-name-casing
class jQuery {
  length: number
  constructor(selector: string){
    const elements = Array.from(document.querySelectorAll(selector))
    const length = elements ? elements.length : 0
    this.length = length
    for(let i=0;i<length;++i){
      this[i] = elements[i]
    }
  }

  html(htmlText: string | undefined) {
    if(htmlText){
      for(let i=0;i<this.length;++i){
        this[i].innerHTML = htmlText
      }
    }else{
      return this[0].innerHTML
    }
  }
}
interface Window {
  $: any;
}

window.$ = function (selector: string) {
  return new jQuery(selector)
}
